<template>
  <div class="experience-box-wrapper">
    <div class="avatar-phone">
      <div class="img-box">
        <img src="../../../assets/image/icon.png" alt="" />
      </div>
      <span>{{ data.phone }}</span>
    </div>
    <div class="time-address">
      <div class="left">
        <div class="top">
          <span class="day">{{ data.day }}</span>
          <span class="time">{{ data.time }}</span>
          <i class="iconfont icon-weizhi"></i>
          <span class="address">{{ data.address }}</span>
        </div>
        <div class="bottom">
          <img src="../../../assets/image/red.png" alt="" />
          <img src="../../../assets/image/red.png" alt="" />
          <img src="../../../assets/image/red.png" alt="" />
          <img src="../../../assets/image/red.png" alt="" />
          <img src="../../../assets/image/red.png" alt="" />
          <span class="score">{{ data.score }}分</span>
          <span class="msg">棒极啦</span>
        </div>
      </div>
      <div class="right" @click="$router.push('/selectCarList')">同店预订</div>
    </div>
    <div class="message">{{ data.message }}</div>
    <div class="img">
      <template v-for="(item, index) in data.img">
        <img @click="clickImg(index)" :src="item" alt="" :key="index" />
      </template>
    </div>
    <div class="agreement-good">
      <span>{{ num }}</span>
      <i
        @click="clickIcon"
        class="iconfont icon-dianzan"
        :class="{ active: isGood }"
      ></i>
    </div>
  </div>
</template>

<script>
import { ImagePreview } from 'vant'
export default {
  name: "ExperienceBox",
  props: {
    data: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      num: this.data.goodsNum,
      isGood: false,
    };
  },
  methods: {
    clickIcon() {
      if (!this.isGood) {
        this.isGood = !this.isGood;
        this.num++;
      } else {
        this.isGood = !this.isGood;
        this.num--;
      }
    },
    clickImg(index) {
      ImagePreview({
        images:this.data.img,
        startPosition: index,
        closeable:true
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.experience-box-wrapper {
  height: 284px;
  padding: 20px 11.25px 0;
  color: #282828;
  border-bottom: 1px solid rgb(235, 233, 233);
  .avatar-phone {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 10px;
    .img-box {
      width: 25px;
      height: 25px;
      overflow: hidden;
      border-radius: 12.5px;
      margin-right: 5px;
      img {
        width: 100%;
        height: 100%;
      }
    }
    span {
      font-size: 13px;
      height: 15px;
      line-height: 15px;
    }
  }
  .time-address {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 42px;
    margin-bottom: 8px;
    .left {
      .top {
        color: #999999;
        font-size: 11px;
        margin-bottom: 5px;
        .day {
          margin-right: 5px;
        }
        .time {
          margin-right: 5px;
        }
        .iconfont {
          margin-right: 5px;
          font-size: 10px;
        }
        .address {
          color: #333;
        }
      }
      .bottom {
        img {
          width: 12px;
          height: 12px;
          margin-right: 5px;
        }
        .score {
          font-size: 10px;
          margin-right: 5px;
        }
        .msg {
          font-size: 12px;
        }
      }
    }
    .right {
      width: 74px;
      height: 27px;
      line-height: 27px;
      text-align: center;
      border: 1px solid #d3d3d3;
      border-radius: 5px;
      color: #333;
      font-size: 13px;
    }
  }
  .message {
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 18px;
  }
  .img {
    display: flex;
    justify-content: space-between;
    align-items: center;
    img {
      display: block;
      width: 110px;
      height: 90px;
      border-radius: 6px;
    }
  }
  .agreement-good {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 5px;
    color: #999999;
    span {
      font-size: 14px;
    }
    .iconfont {
      margin-left: 10px;
    }
    .iconfont.active {
      color: #eb3939;
    }
  }
}
</style>